/**
 * All rights Reserved
 *
 * @Title: CategoryServiceImpl.java
 * @Package com.amigo.online.provider.merchant.service.impl
 * @Description: (用一句话描述该文件做什么)
 * @author: zxy  QQ:1363320658
 * @date: 2018年12月18日 下午3:04:09
 * @version V1.0
 * @Copyright: 2018  All rights reserved.
 */
package com.amigo.online.provider.merchant.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.amigo.online.common.param.common.KeyValueModel;
import com.amigo.online.common.param.result.merchant.CategoryInfo;
import com.amigo.online.provider.merchant.mapper.CategoryMapper;
import com.amigo.online.provider.merchant.model.entity.Category;
import com.amigo.online.provider.merchant.service.CategoryService;
import com.amigo.online.provider.merchant.utils.ConvertUtil;
import com.amigo.online.provider.merchant.utils.LanguageEnum;

/**
 * @version: V 1.0.0
 * @Description: （对类进行功能描述） 
 * @author: zxy  QQ:1363320658
 * @date: 2018年12月18日 下午3:04:09  
 *
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    CategoryMapper categoryMapper;

    public List<KeyValueModel<Long, String>> findLabelCategoryList(Integer labelId, String language) {
        language = LanguageEnum.getColumnName(language);
        return categoryMapper.findLabelCategoryListByLabelId(labelId, language);
    }

    @Override
    public List<CategoryInfo> getCategoryList(String language) {
        List<Category> list = categoryMapper.getHomePageCategory();
        List<CategoryInfo> info = ConvertUtil.categoryToCategoryInfo(language, list);
        return info;
    }
}
